package cn.wolfcode.shop.cloud.util;


import org.apache.commons.codec.digest.DigestUtils;


import java.util.UUID;

public class Md5Util {

    /**
     *
     * @param salt 盐
     * @param password 明文密码
     * @return 密文的密码
     */
    public static String endCode(String salt, String password) {
        String pass = "" + salt.charAt(2) + salt.charAt(3) + password + salt.charAt(4) + salt.charAt(5);
        return DigestUtils.md5Hex(pass);
    }

    public static void main(String[] args) {
        String salt= UUID.randomUUID().toString().replaceAll("-","").substring(0,6);
        String endcodePass=endCode(salt,"111111");
        System.out.println("salt: "+salt);
        System.out.println(endcodePass);
    }


}
